﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Medical_Store_Billing;
using Medical_Store_Billing.Component;
using System.Data.SqlClient;
namespace Medical_Store_Billing
{
    public partial class BackUp : Form
    {
        public BackUp()
        {
            InitializeComponent();
        }
        String file;
        private void button1_Click(object sender, EventArgs e)
        {
            SaveFileDialog sDialog = new SaveFileDialog();
            sDialog.Filter = "File(*.bak)|*.bak";
            if (sDialog.ShowDialog() == DialogResult.OK)
            {
                file = sDialog.FileName;
                txtfile.Text = file;

            }
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            String sql = "backup database medicalstorebilling to disk='" + file + "'";
            SqlConnection conn = new SqlConnection(Dataservice.m_ConnectString);
            SqlCommand cmd = new SqlCommand(sql, conn);
            conn.Open();
            cmd.ExecuteNonQuery();
            MessageBox.Show("Backup thanh cong");
            conn.Close();
        }

        private void BackUp_Load(object sender, EventArgs e)
        {

        }

        private void label2_Click(object sender, EventArgs e)
        {

        }
    }
}
